<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>立即登记新会员</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/module_form.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_memberAdd.css">
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.min.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
<script src="__PUBLIC__/Plugins/Datepicker/WdatePicker.js"></script>
<style type="text/css">
.btns{
	background-color:#339900;
	color:#FFFFFF;
	padding:3px 6px;
	cursor:pointer;
	margin-right:10px;
}
.addressdl{
	width:400px;
	border:1px solid #ccc;
	box-shadow:1px 2px 4px rgba(0,0,0,0.1) inset;
	display:none;
}
.addressdl dl dd{
	line-height:15px;
	cursor:pointer;
}
.addressdl dl .ditu{
	background:#10AE5C;
	text-align:center;
	cursor:default;
}
.addressdl dl .ditu img{
	cursor:pointer;
}
.addressdl dl dd span{
	display:block;
	padding:5px;
}
.addressdl dl dd:hover{
	background:#0774B9;
	color:#fff;
}
</style>
</head>

<body>
 	<div class="page_header">
		<div class="tabbar">
			<ul class="tab clearfix" tabname="tab1">
				<li class="tabhover" show="tab1_0">基本信息</li>
				<!--<li show="tab1_1">上传头像</li>-->
			</ul>
		</div>
	</div> 
	<div class="page_wraper">
		<div id="tab1_0" fortab="tab1">
			<form id="memberAdd_form">
			<input type="hidden" id="solevar"  name="solevar"   value="{$detail.solevar}">
			<input type="hidden" id="id"       name="id"        value="{$detail.id}">
			<input type="hidden" id="pointlng" name="longitude" value="{$detail.longitude}">
			<input type="hidden" id="pointlat" name="latitude"  value="{$detail.latitude}">
			<input type="hidden" id="addid"    name="addressid" value="{$detail.addressid}">
			
			<table cellpadding="0" cellspacing="0" class="module_form" width="600">
				<tr>
					<td class="ele_title"><label for="username">姓名：</label></td>
					<td class="ele_content">
						<input name="realname" value="{$detail.realname}" type="text" class="form_ele_text width_200"></td>
					<td class="ele_title"><label for="sex">性别：</label></td>
					<td class="ele_content">
						<select class="width_200" name="sex" id="sex">
							<option>请选择</option>
							<eq name="detail.sex" value="1">
								<option value="1" selected="selected">先生</option>
								<option value="2">女士</option>
							<else />
								<option value="1">先生</option>
								<option value="2" selected="selected">女士</option>
							</eq>
						</select>
					</td>
				</tr>
				<tr>
					<td class="ele_title"><label for="phone">手机号码1：</label></td>
					<td class="ele_content">
						<input name="mobile" value="{$detail.mobile}" type="text" id="mobile" class="form_ele_text width_200"></td>
				
					
					<td class="ele_title"><label for="phone">手机号码2：</label></td>
					<td class="ele_content">
						<input name="phone" value="{$detail.phone}" type="text" id="phone" class="form_ele_text width_200"></td>
				
				</tr>
				<tr>
					<td class="ele_title"><label for="email">电子邮件：</label></td>
					<td class="ele_content">
						<input name="email" value="{$detail.email}" type="text" id="email" class="form_ele_text width_200"></td>
					<td class="ele_title"><label for="email">电子邮件2：</label></td>
					<td class="ele_content">
						<input name="email2" value="{$detail.email2}" type="text" id="email" class="form_ele_text width_200"></td>
				</tr>
				<!--<tr>
					<td class="ele_title"><label for="address1">标注信息点：</label></td>
					<td colspan="3" class="ele_content">
						<input type="text" name="keywords" id="keywords" placeholder="请输入关键词搜索常用地址或者通过右边的地图标注选择" class="form_ele_text width_400" 
						onKeyUp="showAddress()" autocomplete="off"/>
						<span class="btns">通过地图标注</span>
					</td>
				</tr>
				<tr>
					<td class="ele_title"></td>
					<td class="ele_content" colspan="3">
						<div class="addressdl">
							<dl></dl>
						</div>
					</td>
				</tr>
				<tr>
					<td class="ele_title"><label for="enaddress">详细地址：</label></td>
					<td colspan="3" class="ele_content">
						<input type="text" name="address" id="address" value="{$detail.address}" class="form_ele_text width_400" disabled/>
				</tr>-->
				<tr>
					<td class="ele_title"><label for="enaddress">会员备注：</label></td>
					<td colspan="3" class="ele_content">
						<textarea id="detail" name="remark" placeholder="请输入会员备注" >{$detail.remark}</textarea></td>
				</tr>
				<tr>
					<td class="ele_title"><label for="enaddress">客服备注：</label></td>
					<td colspan="3" class="ele_content">
						<textarea id="detail" name="remark1" placeholder="请输入客服备注" >{$detail.remark1}</textarea></td>
				</tr>
				<tr>
					<td colspan="4" style="height:30px;"></td>
				</tr>
			</table>
			</form>
		</div>
	</div>
	<div class="page_footer pdtd10">
		<input type="button" name="submit" value="提交数据"  class="form_ele_submit"/>
		<input type="reset" name="reset" value="清空数据"  class="form_ele_reset"/>
	</div>
</body>
<script type="text/javascript">
	//弹出窗口全局变量
	var api = frameElement.api, W = api.opener;

	$(function(){
		//滑动门
		$('.tabbar li').click(function(){
			var tabname = $('.tabbar>ul').attr('tabname');
			$('.tabbar li').removeClass('tabhover');
			$(this).addClass('tabhover');
			
			$('div[fortab="'+tabname+'"]').hide();
			$('#'+$(this).attr('show')).show();
		});
		
		//表格隔行换色
		$('.module_form tr:odd').addClass('odd');
		$('.module_form tr:even').addClass('even');
		
		//表单操作
		//重置
		$('.form_ele_reset').on('click',function(){
			$('#memberAdd_form').get(0).reset();
		});
		
		$('#slef').change(function(){
			$("#vipno").val('');
			$("#vipno").attr("readonly",false);
		});
		
		$('#cardid').change(function(){
			if($("#slef").attr("checked")){
				var cardid = $("#cardid").val();
				
				if(cardid){
					$.post("{:U('Vipcard/getVipno')}",{'cardid':cardid},function(data){    //发异步请求会员卡号
						$("#vipno").val(data);
						$("#vipno").attr("readonly","readonly");
					});
				}
			}
		});
		
		//提交
		$('.form_ele_submit').on('click',function(){
			
			var tipsObj = windowApi.lhgdialog.tips('正在提交数据...',10,etIcon.loading);
			var postData = {};
			postData = $("#memberAdd_form").serialize();
			
			$.post("{:U('Custom/edit')}", postData ,function(data){
				tipsObj.close();
				windowApi.lhgdialog.tips('数据提交成功！',1,etIcon.success,function(){
					frameApi.close(); //关闭当前窗口
					var obj = windowApi.lhgdialog.list['Custom_index'];
					if(obj){
						//obj.reload(obj);
						//obj.('.et_tfoot .page_refresh').click(); //刷新加载
						//$('.et_tfoot .page_refresh',obj).click();
						obj.content.$('.page_refresh').click();
					}
				});
			},"json");
		});
		
		//地图标注
		$('.btns').on('click',function(){
			var cityid = $('#cityid').val();
			var href   = "{:U('Order/map')}&model=Custom_edit";
			var width  = '600px';
			var height = '400px';
			var title  = '通过地图选址';
			openDialog('Order_map',href,width,height,title);
		});
	});
	
	function showAddress(){
		var value  = $('#keywords').val();
		var cityid = "{$Think.get.cityid}";
		
		if(value){
			$.get("{:U('Order/site')}",{value:value,cityid:cityid},function(data){
				if(data){
					$('.addressdl dl').html(data);
					$('.addressdl').slideDown();
					
					$('.addressdl dl dd span').click(function(){
						var html  = $(this).text();
						var addid = $(this).attr("did"); 

						$('#pointlng').val('');
						$('#pointlat').val('');
						$('#address').val(html);
						$('#keywords').val(html);
						$('#addid').val(addid);

						$('#address').val(html);
						
						$('.addressdl').slideUp(function(){
							$('.address_choose').slideDown();
						});
					});
				}else{
					var html = "没有找到相应的地址，您可以换一个关键词或者通过地图标注";
					$('.addressdl').slideUp();
					$('.address_choose').slideUp();
				}
			});
		}else{
			$('.addressdl').slideUp();
			return false;
		}
	}
</script>
</html>
